package org.eirudy.shareimage.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.eirudy.shareimage.model.dto.space.SpaceAddRequest;
import org.eirudy.shareimage.model.dto.space.SpaceQueryRequest;
import org.eirudy.shareimage.model.entity.Picture;
import org.eirudy.shareimage.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import org.eirudy.shareimage.model.entity.User;
import org.eirudy.shareimage.model.vo.SpaceVO;


import javax.servlet.http.HttpServletRequest;

/**
* @author Eirudy
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-05-27 15:36:43
*/
public interface SpaceService extends IService<Space> {


    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 校验空间
     * @param space
     * @param add 判断是不是创建空间，如果为true 就是 创建空间，如果是false，就是修改空间
     */
    void validSpace(Space space,boolean add);


    /**
     *  通过查询要求获得对应的queryWrapper
     * @param spaceQueryRequest
     * @return QueryWrapper
     */
    public QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     *  获得简化后的空间
     * @param space
     * @param request
     * @return
     */
    public SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     *  查询空间列表时，获得分页后的空间
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     *  根据空间级别填充空间
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 校验空间权限
     *
     * @param space
     * @param loginUser
     */
    void checkSpaceAuth(Space space, User loginUser);
}
